package com.home.generator.common.response;

/**
 * Description: 分页返回工具类
 * Created by 王大宸 on 2020-06-07 21:16
 * Created with IntelliJ IDEA.
 */
public class PageTableResponse {

    private int code = 0;

    private long count;

    private Object data;

    private String msg;

    private Boolean success;

    private int status;

    public PageTableResponse() {
        super();
    }

    public PageTableResponse(int status, Boolean success, long count, Object data) {
        if (count == 0) {
            this.msg = "暂无数据！";
        }
        this.count = count;
        this.data = data;
        this.status = status;
        this.success = success;
    }

    public PageTableResponse(int status, Boolean success, String msg, long count, Object data) {
        this.msg = msg;
        this.count = count;
        this.data = data;
        this.status = status;
        this.success = success;
    }

    /**
     * 请求成功
     */
    public static PageTableResponse ok(long count, Object data) {
        return new PageTableResponse(200, true, count, data);
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public long getCount() {
        return count;
    }

    public void setCount(long count) {
        this.count = count;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }
}
